Presentation Drafts In Any Environment, Plus Blog And UI Review Fixes - #431
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 25 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe update adds request-time draft rendering, session-aware Sanity fetch options, stricter blog pagination validation, keyed blog navigation boundaries, shared hover and code-block styling, FAQ animation changes, and revised SEO metadata. ChangesDraft rendering and live preview
Blog pagination validation
Presentation and metadata
Estimated code review effort: 3 (Moderate) | ~30 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/web/src/app/layout.tsx (1)
50-76: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftRender draft navigation and footer for a valid draft session.
When a production Presentation session is active,
showDraftsremains false because it only readsDRAFTS_WITHOUT_SESSION. The page routes render drafts for the same session, butCachedNavbarandCachedFooterstill render published navigation, footer, and settings.Move the navbar/footer selection into a Suspense-contained request-time layer. Select dynamic content when
draftMode().isEnabled || DRAFTS_WITHOUT_SESSIONis true. This preserves the static anonymous layout and makes the Presentation view consistent.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/app/layout.tsx` around lines 50 - 76, Update the layout’s navbar and footer selection around showDrafts, CachedNavbar, and CachedFooter by moving the request-time draft-mode check into a Suspense-contained layer. Use dynamic navigation and footer when draftMode().isEnabled or DRAFTS_WITHOUT_SESSION is true; otherwise retain the cached published components, preserving the static anonymous layout.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@apps/web/src/app/layout.tsx`:
- Around line 50-76: Update the layout’s navbar and footer selection around
showDrafts, CachedNavbar, and CachedFooter by moving the request-time draft-mode
check into a Suspense-contained layer. Use dynamic navigation and footer when
draftMode().isEnabled or DRAFTS_WITHOUT_SESSION is true; otherwise retain the
cached published components, preserving the static anonymous layout.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 0e6a4ed6-adb6-42ee-8a60-be5afee3beee
📒 Files selected for processing (14)
apps/web/src/app/[...slug]/page.tsxapps/web/src/app/blog/[slug]/page.tsxapps/web/src/app/blog/page.tsxapps/web/src/app/layout.tsxapps/web/src/app/page.tsxapps/web/src/components/elements/menu-link.tsxapps/web/src/components/footer.tsxapps/web/src/components/mobile-menu.tsxapps/web/src/components/navbar.tsxapps/web/src/lib/seo.tspackages/sanity-blocks/src/faq-accordion/index.tsxpackages/sanity-blocks/src/internal/code-block.tsxpackages/sanity/src/live.tspackages/ui/src/styles/globals.css
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/ui/src/styles/globals.css`:
- Line 291: Update the scroll-driven navbar animation’s animation-duration
declaration from auto to 1ms in the relevant globals.css rule. Keep the existing
scroll timeline and other animation properties unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 05330171-a79a-47a1-9e90-92919ac35a77
📒 Files selected for processing (2)
apps/web/src/components/navbar.tsxpackages/ui/src/styles/globals.css
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/ui/src/styles/globals.css`:
- Around line 301-303: Update the linting configuration for the nested `@supports`
block inside the `@utility` definition, specifically adjusting
no-invalid-position-declaration and the Sonar configuration to accept this valid
pattern. Preserve animation-name: nav-exit unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 251a151f-10ef-438f-b419-7b272054efff
📒 Files selected for processing (1)
packages/ui/src/styles/globals.css
7937114 to
de7cd37
Compare
|



Problem / Intent
Draft mode was gated to
NODE_ENV === "development", so the deployed Studio's Presentation tool could never preview the live site —<VisualEditing />never mounted,<SanityLive>only ever listened for published content, and no stega was emitted, leaving Presentation with "No matching documents". Alongside that, a review pass turned up four unrelated defects: blog pagination kept the previous page on screen during soft navigation, out-of-range pages returned 200, hover treatments used three different colour pairs, and code blocks rendered their code in a different typeface from their line numbers.This branch gates draft rendering on the request's session rather than the environment, and fixes the four review items.
Summary
/api/presentation-draftcan mint (it validates a Sanity preview secret). Anonymous requests still resolve to published content, so/stays statically prerendered and missing routes still return real 404s.page+category; without a key React reconciled it as the same boundary and kept the previous page's posts and pager mounted for the whole server round trip — the URL read?page=2while the grid still showed page 1.?page=3on a two-page blog previously returned 200 with an empty list.codewith the default mono stack, overriding the family inherited from<pre>, so line numbers and code used different fonts and metrics.siteName.Core file changes
packages/sanity/src/live.tsDRAFT_MODE_ENABLED→DRAFTS_WITHOUT_SESSION;getDynamicFetchOptionsnow readsdraftMode()first and only falls back to published when there is no sessionapps/web/src/app/layout.tsx<SanityLive>and the Presentation overlay moved into a Suspense-isolatedLivePreviewLayer, so readingdraftMode()cannot opt the whole layout out of prerenderingapps/web/src/app/page.tsx,[...slug]/page.tsx,blog/[slug]/page.tsxisDraftMode || DRAFTS_WITHOUT_SESSIONinstead of the environment, keeping the published fast path and realnotFound()for everyone elseapps/web/src/app/blog/page.tsxparseBlogPageParam;assertBlogPageInRangecalled fromgenerateMetadataso an out-of-range page 404s before the status is committedpackages/ui/src/styles/globals.csshover-surfacedark hover zinc-800 → zinc-900;.rich-codegains shared inset variables, inheritedline-heightand a two-digit guttermin-widthpackages/sanity-blocks/src/internal/code-block.tsxfont-monoon<code>so the utilities layer beats Preflightpackages/sanity-blocks/src/faq-accordion/index.tsxbg-backgroundso the new hover is visible;duration-300→animation-duration-300so the entrance no longer stretches the hover fadeapps/web/src/components/navbar.tsx,mobile-menu.tsx,elements/menu-link.tsxhover:bg-zinc-200 dark:hover:bg-zinc-800replaced with the sharedhover-surfaceutilityapps/web/src/components/footer.tsxapps/web/src/lib/seo.tssiteNameadded toopenGraphVerification
pnpm check-types— 8/8pnpm lint— 9/9pnpm format:check— 9/9pnpm test— 213 tests, 26 filespnpm build:web—/still○ (Static);/[...slug],/blog,/blog/[slug]still◐ (Partial Prerender)/api/presentation-draftreturns 401 with no secret and with a bogus secret/blog, click "Next page" — the grid and the pager both move to page 2. A/B against an instrumented build: unkeyed held page 1 for 4081ms with the pager stuck on "1"; keyed drops to 41ms and shows the skeleton/blog?page=3returns 404 for a crawler user-agent#f4f4f5light /#18181bdarkSummary by CodeRabbit